{template 'common/header'}
{template 'nav'}
<form action="" method="post" class="form-horizontal" role="form">
<input type="hidden" value="{$sd_config['id']}"  name="sd_config_id">
<div class="panel panel-default">
	<div class="panel-heading">基本设置</div>	
	<div class="panel-body">
	<div class="tab-content">
	<div class="tab-pane  active" id="tab_basic">
		<div class="panel panel-default">
			<div class="panel-heading"></div>					
			<div class="panel-body">
				<div class="form-group" style="display:none">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">3d签到背景</label>
					<div class="col-sm-9">
						{php echo tpl_form_field_image('bg', $sd_config['bg']);}
						<span class="help-block">3d签到背景</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">上传占位广告图</label>
					<div class="col-sm-9">
						{php echo tpl_form_field_multi_image('placeholder_image_arr', $sd_config['placeholder_image_arr']);}
						<span class="help-block">上传占位广告图 最多可添加9张logo，推荐尺寸200^200像素，50KB以下</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2  control-label">是否开启倒计时</label>
					<div class="col-sm-9 ">
						<label class="radio-inline">
							<input type="radio" name="count_down_on" value="0" id="show_time_0" {if $sd_config['count_down_on'] == '0'}checked="true"{/if} onclick="show_count1()"> 不开启
						</label>
						<label class="radio-inline">
							<input type="radio" name="count_down_on" value="1" id="show_time_1"  {if $sd_config['count_down_on'] == '1'}checked="true"{/if} onclick="show_count2()">开启
						</label>
					</div>
				</div>
				<div class="form-group cd_time" style="{if $sd_config['count_down_on']==0}display:none{/if}">
									<label class="col-xs-12 col-sm-3 col-md-2  control-label">倒计时时间</label>
									<div class="col-sm-9 ">
										<div class="input-group">
											<input type="text" name="count_down_time"  class="form-control count_down_time" value="{$sd_config['count_down_time']}">
											<span class="input-group-addon">秒</span>
										</div>
										<span class="help-block">秒 注意:小于10的整数</span>
									</div>
				</div>
				<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">设置内容</label>
				 <div class="col-xs-12 col-sm-9">
					<div class="panel panel-default live_advs">
										  <div class="panel-body">
										  <ul class="list-group" id="vote_lists">
															  {loop $sd_config['str'] $key $row}
																
																	<li class="list-group-item ng-scope" id="3d_box_{$key}">
																	<div class="form-group">
																		<label class="col-xs-12 col-sm-3 col-md-3 control-label">第{php echo $key+1}屏</label>
																		{if $row['type']=='Text'}
																		<div class="col-sm-9 col-xs-12  col-md-8 ">
																			<input type="text" name="text[]" class="form-control" value="{$row['value']}" />
																			<input type="hidden" name="type[]" value="Text" />
																			<input type="hidden" name="Countdown[]" value="" />
																			<input type="hidden" name="3dLogo[]" value="" />
																		</div>
																		{elseif $row['type']=='Sphere'}
																		<div class="col-sm-9 col-xs-12  col-md-8 ">
																			<input type="hidden" name="3dLogo[]" value="" />
																			<input type="hidden" name="type[]" value="Sphere" />
																			<input type="hidden" name="Countdown[]" value="" />
																			<input type="text" name="text[]" class="form-control" value="3d球体"  readonly />
																		</div>
																		{elseif $row['type']=='Helix'}
																		<div class="col-sm-9 col-xs-12  col-md-8 ">
																			<input type="hidden" name="type[]" value="Helix" />
																			<input type="hidden" name="3dLogo[]" value="" />
																			<input type="hidden" name="Countdown[]" value="" />
																			<input type="text" name="text[]" class="form-control" value="3d螺旋"  readonly />
																		</div>
																		{elseif $row['type']=='Torus'}
																		<div class="col-sm-9 col-xs-12  col-md-8 ">
																			<input type="hidden" name="3dLogo[]" value="" />
																			<input type="hidden" name="type[]" value="Torus" />
																			<input type="hidden" name="Countdown[]" value="" />
																			<input type="text" name="text[]" class="form-control" value="3d时空隧道"  readonly />
																		</div>
																		{elseif $row['type']=='Logo'}
																				<input type="hidden" name="type[]" value="Logo" />
																				<input type="hidden" name="Countdown[]" value="" />
																				<input type="hidden" name="text[]" class="form-control" value="" />
																				<div class="col-sm-9 col-md-8">
																					{php echo tpl_form_field_image('3dLogo[]',$row['value']);}
																				</div>
																		{elseif $row['type']=='Countdown'}
																		<div class="col-sm-9 col-xs-12  col-md-8 ">
																				<input type="hidden" name="type[]" value="Countdown" />
																				<input type="hidden" name="3dLogo[]" value="" />
																				<input type="hidden" name="text[]" class="form-control" value="" />
																				<input type="text" name="Countdown[]" class="form-control countdown_check" value="{$row['value']}" />
																	    </div>
																		{/if}
																		<div class="col-sm-8  col-xs-12 col-md-1">
																				<a href="javascript:;" class="btn btn-danger" onclick="sd_delete({$key})" >删除</a>
																	    </div>
																	   
																	</div>
																	</li>
																
															 {/loop}
											    
										  </ul>
										  </div>
										  
									</div>
					</div>
				  </div>
				<!----->
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">&nbsp;</label>
					<div class="col-sm-9">
                	<a href="javascript:;" class="btn btn-success" id="addText"><b>+</b>添加文字</a><i>(每次限制4个中文或4个英文字母以内)</i><br><br> 
                    <a href="javascript:;" class="btn btn-success" id="addSphere"><b>+</b>添加球体</a>
                    <a href="javascript:;" class="btn btn-success" id="addHelix"><b>+</b>添加螺旋</a>
                    <a href="javascript:;" class="btn btn-success" id="addTorus"><b>+</b>添加时空隧道</a><br><br>
                	<a href="javascript:;" class="btn btn-success" id="addLogo"><b>+</b>插入LOGO</a><i>(仅限透明png图片 200*200px)</i>
					</div>
                </div>
			</div>
		</div>
		<div class="form-group col-sm-12">
			<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>

	</div>
	</div>
	</div>
	</div>
	</form>
<div class="addText" style="display: none">	
		<label class="col-xs-12 col-sm-3 col-md-3 control-label"></label>
		<div class="col-sm-9 col-xs-12 col-md-8">
			<input type="hidden" name="3dLogo[]" value="" />
			<input type="hidden" name="Countdown[]" value="" />
			<input type="hidden" name="type[]" value="Text" />
			<input type="text" name="text[]" class="form-control"/>
		</div>
</div>
<div class="addSphere" style="display: none">	
		<label class="col-xs-12 col-sm-3 col-md-3 control-label"></label>
		<div class="col-sm-9 col-xs-12 col-md-8">
			<input type="hidden" name="3dLogo[]" value="" />
			<input type="hidden" name="Countdown[]" value="" />
			<input type="hidden" name="type[]" value="Sphere" />
			<input type="text" name="Sphere[]" class="form-control" value="3d球体" readonly />
		</div>
</div>
<div class="addHelix" style="display: none">	
		<label class="col-xs-12 col-sm-3 col-md-3 control-label"></label>
		<div class="col-sm-9 col-xs-12 col-md-8">
			<input type="hidden" name="3dLogo[]" value="" />
			<input type="hidden" name="Countdown[]" value="" />
			<input type="hidden" name="type[]" value="Helix" />
			<input type="text" name="Helix[]" class="form-control" value="3d螺旋" readonly />
		</div>
</div>
<div class="addTorus" style="display: none">	
		<label class="col-xs-12 col-sm-3 col-md-3 control-label"></label>
		<div class="col-sm-9 col-xs-12 col-md-8">
			<input type="hidden" name="3dLogo[]" value="" />
			<input type="hidden" name="Countdown[]" value="" />
			<input type="hidden" name="type[]" value="Torus" />
			<input type="text" name="Torus[]" class="form-control" value="3d时空隧道" readonly />
		</div>
</div>
<div class="addLogo" style="display: none">	
		<label class="col-xs-12 col-sm-3 col-md-3 control-label">3dLogo</label>
		<div class="col-sm-9 col-md-8">
			<input type="hidden" name="type[]" value="Logo" />
			<input type="hidden" name="Countdown[]" value="" />
			<input type="hidden" name="text[]" class="form-control" value="" />
			{php echo tpl_form_field_image('3dLogo[]','');}
			<span class="help-block">3dLogo 200*200 PNG 透明</span>
		</div>
</div>
<div class="addCountdown" style="display: none">	
		<label class="col-xs-12 col-sm-3 col-md-3 control-label"></label>
		<div class="col-sm-9 col-xs-12 col-md-8">
			<input type="hidden" name="3dLogo[]" value="" />
			<input type="hidden" name="type[]" value="Countdown" />
			<input type="text" name="Countdown[]" class="form-control countdown_check" placeholder="请输入倒计时秒数" value="5" />
			<input type="hidden" name="text[]" class="form-control" value="" />
		</div>
</div>
<script type="text/javascript">
$(function(){
$('#addText').on('click', function(){
		var bd_add = new Date().getTime();
		var content = '<li class="list-group-item ng-scope" id="3d_box_'+bd_add+'"><div class="form-group">';
		content += $(".addText").html();
		content += '<div class="col-sm-8  col-xs-12 col-md-1">';
				 content += '<a href="javascript:;" class="btn btn-danger" onclick="sd_delete('+bd_add+')" >删除</a>';
					content += '</div>';
				content += '</div>';
		content += '</li>';
		$('#vote_lists').append(content);
		var list_length = $('#vote_lists li').length;
		$('#vote_lists li:last-child label:first').text("第"+list_length+"屏");
		//$('#vote_lists li:last-child input:last').val(0);
		
});
$('#addSphere').on('click', function(){
		var bd_add = new Date().getTime();
		var content = '<li class="list-group-item ng-scope" id="3d_box_'+bd_add+'"><div class="form-group">';
		content += $(".addSphere").html();
		content += '<div class="col-sm-8  col-xs-12 col-md-1">';
				 content += '<a href="javascript:;" class="btn btn-danger" onclick="sd_delete('+bd_add+')" >删除</a>';
					content += '</div>';
				content += '</div>';
		content += '</li>';
		$('#vote_lists').append(content);
		var list_length = $('#vote_lists li').length;
		$('#vote_lists li:last-child label:first').text("第"+list_length+"屏");
		
});
$('#addHelix').on('click', function(){
		var bd_add = new Date().getTime();
		var content = '<li class="list-group-item ng-scope" id="3d_box_'+bd_add+'"><div class="form-group">';
		content += $(".addHelix").html();
		content += '<div class="col-sm-8  col-xs-12 col-md-1">';
				 content += '<a href="javascript:;" class="btn btn-danger" onclick="sd_delete('+bd_add+')" >删除</a>';
					content += '</div>';
				content += '</div>';
		content += '</li>';
		$('#vote_lists').append(content);
		var list_length = $('#vote_lists li').length;
		$('#vote_lists li:last-child label:first').text("第"+list_length+"屏");
		
});
$('#addTorus').on('click', function(){
		var bd_add = new Date().getTime();
		var content = '<li class="list-group-item ng-scope" id="3d_box_'+bd_add+'"><div class="form-group">';
		content += $(".addTorus").html();
		content += '<div class="col-sm-8  col-xs-12 col-md-1">';
				 content += '<a href="javascript:;" class="btn btn-danger" onclick="sd_delete('+bd_add+')" >删除</a>';
					content += '</div>';
				content += '</div>';
		content += '</li>';
		$('#vote_lists').append(content);
		var list_length = $('#vote_lists li').length;
		$('#vote_lists li:last-child label:first').text("第"+list_length+"屏");
		
});
$('#addLogo').on('click', function(){
		var bd_add = new Date().getTime();
		var content = '<li class="list-group-item ng-scope" id="3d_box_'+bd_add+'"><div class="form-group">';
		content += $(".addLogo").html();
		content += '<div class="col-sm-8  col-xs-12 col-md-1">';
				 content += '<a href="javascript:;" class="btn btn-danger" onclick="sd_delete('+bd_add+')" >删除</a>';
					content += '</div>';
				content += '</div>';
		content += '</li>';
		$('#vote_lists').append(content);
		var list_length = $('#vote_lists li').length;
		$('#vote_lists li:last-child label:first').text("第"+list_length+"屏");
		
});
$('#addCountdown').on('click', function(){
		var countdown_check = $('.countdown_check').length;
		if(countdown_check > 1){
			alert('倒计时只能添加一次');
			return;
		}
		var bd_add = new Date().getTime();
		var content = '<li class="list-group-item ng-scope" id="3d_box_'+bd_add+'"><div class="form-group">';
		content += $(".addCountdown").html();
		content += '<div class="col-sm-8  col-xs-12 col-md-1">';
				 content += '<a href="javascript:;" class="btn btn-danger" onclick="sd_delete('+bd_add+')" >删除</a>';
					content += '</div>';
				content += '</div>';
		content += '</li>';
		$('#vote_lists').append(content);
		var list_length = $('#vote_lists li').length;
		$('#vote_lists li:last-child label:first').text("第"+list_length+"屏");
		
});
$(".count_down_time").on('blur', function(e){
				
                if (parseInt($(this).val())==0 || parseInt($(this).val()) > 9) {
                    alert('请填写大于0、小于9的整数');
					$(this).val(9);
					return;
                } 
});
})
function sd_delete(id){
	
		$("#3d_box_"+id).remove();
		$('#vote_lists li').each(function(i,val){
			var new_num = $(this).index()+1;
			$(this).find('label:first').text('第'+new_num+'屏');
		});
	
}
function show_count1(){
	$('.cd_time').hide();
}
function show_count2(){
	$('.cd_time').show();
}
  </script> 
{template 'common/footer'}
